<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>

    <el-card>
      <template>
        <el-table
          :data="tableData"
          stripe
          border
          style="width: 100%">
          <el-table-column
            prop="authName"
            label="#"
            type="index">
          </el-table-column>
          <el-table-column
            prop="id"
            label="权限id">
          </el-table-column>
          <el-table-column
            prop="pid"
            label="权限父id">
          </el-table-column>
          <el-table-column
            prop="authName"
            label="权限名称">
          </el-table-column>
          <el-table-column
            prop="path"
            label="路径">
          </el-table-column>
          <el-table-column
            prop="level"
            label="权限等级" >
            <template slot-scope="scope">
              <el-tag v-if="scope.row.level === '0' ">标签一</el-tag>
              <el-tag v-else-if="scope.row.level === '1' " type="success">标签二</el-tag>
              <el-tag v-else type="info">标签三</el-tag>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </el-card>
  </div>
</template>

<script>
/* eslint-disable */
export default {
  name: 'Rights',
  data () {
    return {
      tableData: []
    }
  },
  created () {
    this.gettableData()
  },
  methods: {
    async gettableData () {
      const { data: res } = await this.$http.get('rights/list')
      console.log(res)
      if (res.meta.status !== 200) {
        return this.$message.error(res.meta.msg)
      }
      this.tableData = res.data
      console.log(res)
    }
  }
}
</script>

<style lang="less" scoped>
  .el-breadcrumb {
    margin-bottom: 15px;
    font-size: 12px;
  }
  .el-card {
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
  }

  .el-table {
    margin-top: 15px;
    font-size: 12px;
  }

  .text {
    font-size: 14px;
  }

  .item {
    padding: 18px 0;
  }
</style>
